#ifndef __POWER_H
#define __POWER_H

#include "device.h"

#define Set_U_adr     0x0000  //协议寄存器通讯地址
#define Set_I_adr     0x0001
#define SW_adr        0x0002
#define CCCV_adr      0x1000
#define current_U_adr 0x1001
#define current_I_adr 0x1002
#define temperature_adr 0x1003

#define r_power 0x03  //设置电压和限流电流的操作码
#define w_power 0x10  //读取多个寄存器的操作码

typedef struct
{
    PID_HANDLE  power_ctrl;
    double current_U;
    double current_I;
    double set_U;
    double set_I;
    int get_count; //监视获得数据的次数
}_POWER,*P_POWER;

uint16_t  N_CRC16(uint8_t *updata, int len);  
void Power_get(void);
void Power_set(float U,float I);
void Power_Init(P_POWER POWER);

#endif

